package com.bjpowernode.tools;
import java.time.*;
public class MyTools {
    //日期转换
    public static long getTime(LocalDate localDate) {
        //把localDate去掉时钟转成LocalDateTime
        LocalDateTime localDateTime = localDate.atStartOfDay();
        //只有LocalDateTime才能变成时区时钟
        ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.systemDefault());
        //利用时区时钟转换为机器时间
        Instant instant = zonedDateTime.toInstant();
        //在返回纪元时间（1970-1-1到目标的毫秒数）
        return instant.toEpochMilli();
    }
}
